home *** CD-ROM | disk | FTP | other *** search
- /* DemoWin.C: Programma dimostrativo per le funzioni relative alla
- gestione delle finestre di PcWindow */
-
- /* Allegato alla versione 1.31 di PcWindow */
-
-
- #include <pcw.h>
- #include <stdio.h>
- #include <string.h>
- #include <conio.h>
- #include <stdlib.h>
-
-
- /* Definizione attributi video */
-
- #define NORMATT attrib(WHITE, NORMAL, BLACK, STEADY)
- #define WND1 attrib(WHITE, NORMAL, BLUE, STEADY)
- #define SCRITTE attrib(RED, HILIGHT, BLUE, BLINK)
-
-
- void main(void)
- {
- int i,j,k;
- char s[21], c;
- char t[21], ds[11];
-
-
- strcpy(s,"Prova di scrittura ");
-
-
- if (Pcw_init(3,3,400) != OK) /* Inizializza il toolkit */
- exit(1);
-
- Pcw_clear_screen(NORMATT);
-
- Pcw_beep();
-
- printf("Questo testo e' sul video di sfondo\n");
- printf("gestito dal DOS: %s\n\n", s);
-
-
- Pcw_no_flick(); /* Vengono disabilitati i
- flickers */
-
- Pcw_copyright(13); /* Stampa il copyright */
-
-
- /* Qui segue la definizione delle tre finestre adoperate */
-
- Pcw_define(0,20,20,LT_DOUBLE,attrib(GREEN,NORMAL,RED,STEADY),
- WND1,reverse(WND1), 20,20,"Esempio");
- Pcw_define(1,50,5,LT_SINGLE, attrib(BLUE,NORMAL,GREEN,STEADY),
- attrib(BLUE,NORMAL,WHITE,STEADY),attrib(BLUE,NORMAL,WHITE,STEADY),
- 50,5,"\0");
-
- Pcw_sprintat(1,2,1," Pc Window: Personal Computer Window System ",SCRITTE);
- Pcw_sprintat(1,2,2," Versione 1.31 ",SCRITTE);
- Pcw_sprintat(1,2,3," Copyright (c) 1988 - Pasquale Cantiello ",SCRITTE);
-
- Pcw_define(2,22,3,NO_BORDER,attrib(GREEN,NORMAL,RED,STEADY),
- reverse(WND1),WND1,22,3,"\0");
-
- Pcw_sprintat(2,0,0, "Un tasto qualunque per", reverse(WND1));
- Pcw_sprintat(2,0,1, "terminare alla fine", reverse(WND1));
- Pcw_sprintat(2,0,2, "del ciclo", reverse(WND1));
-
-
- /* Di seguito viene eseguito un ciclo delle principali funzioni:
- 2 volte per ognuna delle 3 velocita' */
-
- for (i = 1; i <= 6; i++) {
- Pcw_write_25(" Dimostrativo in esecuzione", attrib(RED, HILIGHT, BLUE,
- BLINK));
- if (i == 1)
- Pcw_set_speed(VERYFAST);
- else if (i == 3)
- Pcw_set_speed(FAST);
- else if (i == 5)
- Pcw_set_speed(SLOW);
-
- Pcw_open_pos(1,FADEHORIZ,10,3);
- Pcw_open_pos(2, FADERIGHT, 30, 11);
- Pcw_move_rel(UP, 8, FADE);
- Pcw_move_rel(LEFT, 20, FADE);
- Pcw_move_rel(DOWN, 8, FADE);
- Pcw_move_rel(RIGHT, 20, FADE);
- Pcw_open(0,ISTANT);
- Pcw_cls(0,0);
- strcpy(t,s);
- t[20]='\0';
-
- /* Viene scritto questo pattern di caratteri utile per verificare
- gli effetti di movimento e di scrolling */
-
- for (j = 1; j <= 20; j++) {
- Pcw_sprintat(0,0,j-1,t,attrib(WHITE,NORMAL,BLUE,STEADY));
- c = t[19];
- for (k = 0; k<19; k++)
- t[19-k] = t[19-k-1];
- t[0] = c;
- }
- Pcw_set_input_flag(VIS);
- Pcw_set_input_mode(BLANK, attrib(WHITE,NORMAL,BLUE,STEADY),
- attrib(BLUE, NORMAL, WHITE, BLINK), ALL);
- Pcw_input(IT_ALFANUM,5,8,10,"Input",ds);
- Pcw_input(IT_ALFANUM,5,12,10,"Secondo",ds);
- Pcw_size(0,RESTRICT,BOTH,5,ISTANT);
- Pcw_size(0,ENLARGE,BOTH,5,ISTANT);
- Pcw_close(ISTANT);
- Pcw_open(0,FADELEFT);
- Pcw_size(0,RESTRICT,LEFT,5,FADE);
- Pcw_size(0,ENLARGE,LEFT,5,FADE);
- Pcw_close(FADELEFT);
- Pcw_open(0,FADERIGHT);
- Pcw_size(0,RESTRICT,RIGHT,5,FADE);
- Pcw_size(0,ENLARGE,RIGHT,5,FADE);
- Pcw_close(FADERIGHT);
- Pcw_open(0,FADEHORIZ);
- Pcw_size(0,RESTRICT,HORIZ,5,FADE);
- Pcw_size(0,ENLARGE,HORIZ,5,FADE);
- Pcw_close(FADEHORIZ);
- Pcw_open(0,FADEUP);
- Pcw_size(0,RESTRICT,UP,5,FADE);
- Pcw_size(0,ENLARGE,UP,5,FADE);
- Pcw_close(FADEUP);
- Pcw_open(0,FADEDOWN);
- Pcw_size(0,RESTRICT,DOWN,5,FADE);
- Pcw_size(0,ENLARGE,DOWN,5,FADE);
- Pcw_close(FADEDOWN);
- Pcw_open(0,FADEVERT);
- Pcw_size(0,RESTRICT,VERT,5,FADE);
- Pcw_size(0,ENLARGE,VERT,5,FADE);
- Pcw_size(0,RESTRICT,BOTH,5,FADE);
- Pcw_scroll(0,UP,5,FADE);
- Pcw_scroll(0,RIGHT,5,FADE);
- Pcw_scroll(0,DOWN,5,FADE);
- Pcw_scroll(0,LEFT,5,FADE);
- Pcw_set_view(0,3,3);
- Pcw_set_view(0,5,5);
- Pcw_size(0,ENLARGE,BOTH,5,FADE);
- Pcw_move_abs(20,3,FADEHORIZ);
- Pcw_move_abs(0,0,FADEVERT);
- Pcw_move_rel(RIGHT,20,FADE);
- Pcw_move_rel(LEFT,20,FADE);
- Pcw_move_rel(DOWN,3,FADE);
- Pcw_move_rel(UP,3,FADE);
- Pcw_close(FADEVERT);
- Pcw_close(FADEHORIZ);
- Pcw_close(FADERIGHT);
- if (kbhit())
- break;
- }
- Pcw_beep();
- Pcw_clear_screen(NORMATT);
- }
-